using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.Tilemaps;

public class TilemapController:MonoBehaviour {

	public static TilemapController instance;
	Grid grid;
	Tilemap tilemap;

	private void Awake() {
		instance=this;
		grid=GetComponent<Grid>();
		tilemap=GetComponent<Tilemap>();
	}
	private void OnDestroy() {
		instance=null;
	}


	public TileBase[] unpassableList;

	public static bool CanPass(Vector2Int position) {
		if(!instance) return false;
		TileBase tileHere = instance.tilemap.GetTile(new Vector3Int(position.x,position.y));
		if(instance.unpassableList.Contains(tileHere)) return false;
		return true;
	}

}
